package ihm;

import java.awt.EventQueue;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.JInternalFrame;
import javax.swing.JTable;

import metier.Employe;
import javax.swing.JScrollPane;

import dao.DAO_Employe;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

public class FenetreVoirEmploye extends JInternalFrame
{
	private JTable lstEmploye;
	private Vector<Employe> lesEmployes;
	private Object[][] lignes;
	private JScrollPane scrollPane;
	private JPanel panel;

	public FenetreVoirEmploye()
	{	
		setRootPaneCheckingEnabled(false);
		javax.swing.plaf.InternalFrameUI ui = this.getUI();
		((javax.swing.plaf.basic.BasicInternalFrameUI)ui).setNorthPane(null);
		setBorder(null);
		
		this.lesEmployes = DAO_Employe.getLesEmployes();
		setBounds(100, 100, 710, 440);
		getContentPane().setLayout(null);	
		
		
		String titres[]={"IDEMPLOYE","NOM","PRENOM","TELEPHONE"};
		lignes=new Object[lesEmployes.size()][4];
		int i = 0;
		for (Employe e : lesEmployes)
		{
		    	lignes[i][0] = e.getIdEmploye();
		    	lignes[i][1] = e.getNomEmploye();
		    	lignes[i][2] = e.getPrenomEmploye();
		    	lignes[i][3] = e.getTelephone();
		   	i++;
		}
		
		scrollPane = new JScrollPane();
		scrollPane.setBounds(33, 57, 632, 257);
		getContentPane().add(scrollPane);
		this.lstEmploye=new JTable(lignes,titres);
		scrollPane.setViewportView(lstEmploye);
		
		panel = new JPanel();
		panel.setBorder(new TitledBorder(null, "Voir les employ\u00E9s", TitledBorder.LEADING, TitledBorder.TOP, new Font("Tahoma", Font.BOLD, 13)));
		panel.setBounds(10, 29, 674, 307);
		getContentPane().add(panel);
		
		// Block la saisi du tableau
		lstEmploye.setEnabled(false);
	}
}
